package ${packageName}.domain;

import com.boss.core.domain.AbstractAuditingEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import java.io.Serializable;
import java.time.Instant;
import java.math.BigDecimal;
<#if useLombok>
import lombok.Data;
</#if>
/**
 * ${classInfo.classComment}
 *
 * @author ${authorName} ${.now?string('yyyy-MM-dd')}
 */
<#if useLombok>
@Data
</#if>
@Entity
@Table(name = "${classInfo.tableName}")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class ${classInfo.className} extends AbstractAuditingEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    <#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
    <#list classInfo.fieldList as fieldItem >
    <#if fieldItem.fieldName != "createdDate" && fieldItem.fieldName != "createdBy" && fieldItem.fieldName != "lastModifiedDate"  && fieldItem.fieldName != "lastModifiedBy">
    /**
     * ${fieldItem.fieldComment}
     */
    <#if fieldItem.required && fieldItem.fieldName != "id">
    @NotNull
    </#if>
    <#if fieldItem.size gt 0>
    @Size(max = ${fieldItem.size?c})
    </#if>
    @Column(name = "${fieldItem.columnName}"<#if fieldItem.size gt 0>, length = ${fieldItem.size?c}</#if><#if fieldItem.required && fieldItem.fieldName != "id">, nullable = false</#if>)
    private ${fieldItem.fieldClass} ${fieldItem.fieldName};

    </#if>
    </#list>
<#if !useLombok>
    <#list classInfo.fieldList as fieldItem >
    <#if fieldItem.fieldName != "createdDate" && fieldItem.fieldName != "createdBy" && fieldItem.fieldName != "lastModifiedDate"  && fieldItem.fieldName != "lastModifiedBy">
    public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
        return ${fieldItem.fieldName};
    }
    public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
        this.${fieldItem.fieldName} = ${fieldItem.fieldName};
    }

    </#if>
    </#list>
</#if>
</#if>

}
